package com.chixing.controller;

import com.alipay.api.kms.aliyun.http.HttpRequest;
import com.chixing.commons.ServerResponse;
import com.chixing.commons.TokenUtil;
import com.chixing.pojo.JobAndCompany;
import com.chixing.pojo.LoginPerson;
import com.chixing.service.RecommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
public class RecommentController {
    @Autowired
    private RecommentService recommentService;

//    /**
//     * 基于用户的推荐
//     * @param perId
//     * @param num
//     * @return
//     */
//    @GetMapping("recommendByCollect/{perId}/{num}")
//    public List<JobAndCompany> getRecommendJobByCollect(@PathVariable("perId") Integer perId,@PathVariable Integer num){
//        return recommentService.getRecommentByCollect(perId,num);
//    }


    @PostMapping("recommendByJob")
    public ServerResponse getJobByJob(String token, Integer jobId, Integer num){
        LoginPerson loginPerson = TokenUtil.parseToken(token);
        Integer perId=loginPerson.getPersonId();
        num=3;
        List<JobAndCompany> list = recommentService.getRecommentByCollectJob(perId, jobId, num);

        return ServerResponse.success("success",list);

    }
}
